package org.rpc.blance;

import org.rpc.common.URL;

import java.util.List;
import java.util.Random;

/**
 * @author tzf
 * @description: 随机的负载均衡实现
 * @date: 2023/11/17 15:33
 */

public class SimpleLoadBalance implements LoadBalance {
    @Override
    public URL loadBalance(List<URL> urls) {
        if (urls == null) return new URL();
        Random random = new Random();
        return urls.get(random.nextInt(urls.size()));
    }
}
